<style scoped lang="scss" type="text/scss">
  @import '~variables';

  .search {
    /deep/ .mint-search-list-warp{
      .mint-cell{
        padding: 0 $m;
        @include border(bottom);
      }
      }
  }
</style>

<template>
  <div>
    <mt-search class="search" v-model="search" autofocus :result="searchResult" placeholder="输入关键词搜索"></mt-search>
  </div>
</template>

<script>
  export default {
    name: 'v-search',
    data () {
      return {
        search: '',
        searchResult: []
      }
    },
    created () {
      this.fetchData()
    },
    methods: {
      fetchData () {
        this.$http.get('/api/book/listBook',{
          categoryId: 1
        })
          .then((res) => {
            if (res) {
              res.result.list.forEach((value) => {
                this.searchResult.push(value.title)
              })
            }
          })
      }
    }
  }
</script>
